import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/api/auth/v1/user/login',
    method: 'post',
    data: data
  })
}

export function getInfo(token) {
  return request({
    url: '/api/auth/v1/user/info',
    method: 'get',
    params: { token }
  })
}

export function login1(data) {
  return request({
    url: '/vue-element-admin/user/login',
    method: 'post',
    data
  })
}

export function getInfo1(token) {
  return request({
    url: '/vue-element-admin/user/info',
    method: 'get',
    params: { token }
  })
}

export function logout() {
  return request({
    url: '/vue-element-admin/user/logout',
    method: 'post'
  })
}

export function getUserListFunction() {
  return request({
    url: 'api/data/v1/user/list/function',
    method: 'get',
    headers: {
      token: '123'
    }

  })
}
export function getUserFunctionList() {
  return request({
    url: 'api/data/v1/userfunction/list',
    method: 'get',
    headers: {
      token: '123'
    }

  })
}
// 添加用户权限
export function postUserFunction(user_id, funcData) {
  return request({
    url: 'api/data/v1/user/' + user_id + '/function',
    method: 'post',
    headers: {
      token: '123'
    },
    data: funcData

  })
}

// 添加用户权限
export function deleteUserFunction(user_id, funcData) {
  return request({
    url: 'api/data/v1/user/' + user_id + '/function',
    method: 'delete',
    headers: {
      token: '123'
    },
    data: funcData
  })
}

// 添加用户权限
export function operatUserFunction(user_id, funcData, operat) {
  return request({
    url: 'api/data/v1/user/' + user_id + '/function',
    method: operat,
    headers: {
      token: '123'
    },
    data: funcData
  })
}
